home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgramD2.iso / J A V A / Java Development Kit V1.2 / jdk12-win32(1).exe / data1.cab / demos / demo / jfc / Metalworks / ContrastMetalTheme.java < prev    next >
Encoding:
Java Source  |  1998-12-01  |  3.3 KB  |  85 lines

  1. /*
  2.  * @(#)ContrastMetalTheme.java    1.11 98/08/26
  3.  *
  4.  * Copyright 1998 by Sun Microsystems, Inc.,
  5.  * 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
  6.  * All rights reserved.
  7.  *
  8.  * This software is the confidential and proprietary information
  9.  * of Sun Microsystems, Inc. ("Confidential Information").  You
  10.  * shall not disclose such Confidential Information and shall use
  11.  * it only in accordance with the terms of the license agreement
  12.  * you entered into with Sun.
  13.  */
  14.  
  15. import javax.swing.plaf.*;
  16. import javax.swing.plaf.basic.*;
  17. import javax.swing.plaf.metal.*;
  18. import javax.swing.*;
  19. import javax.swing.border.*;
  20. import java.awt.*;
  21.  
  22. /**
  23.  * This class describes a higher-contrast Metal Theme.
  24.  *
  25.  * @version 1.11 08/26/98
  26.  * @author Michael C. Albers
  27.  */
  28.  
  29. public class ContrastMetalTheme extends DefaultMetalTheme {
  30.  
  31.     public String getName() { return "Contrast"; }
  32.  
  33.     private final ColorUIResource primary1 = new ColorUIResource(0, 0, 0);
  34.     private final ColorUIResource primary2 = new ColorUIResource(204, 204, 204);
  35.     private final ColorUIResource primary3 = new ColorUIResource(255, 255, 255);
  36.     private final ColorUIResource primaryHighlight = new ColorUIResource(102,102,102);
  37.  
  38.     private final ColorUIResource secondary2 = new ColorUIResource(204, 204, 204);
  39.     private final ColorUIResource secondary3 = new ColorUIResource(255, 255, 255);
  40.     private final ColorUIResource controlHighlight = new ColorUIResource(102,102,102);
  41.  
  42.     protected ColorUIResource getPrimary1() { return primary1; } 
  43.     protected ColorUIResource getPrimary2() { return primary2; }
  44.     protected ColorUIResource getPrimary3() { return primary3; }
  45.     public ColorUIResource getPrimaryControlHighlight() { return primaryHighlight;}
  46.  
  47.     protected ColorUIResource getSecondary2() { return secondary2; }
  48.     protected ColorUIResource getSecondary3() { return secondary3; }
  49.     public ColorUIResource getControlHighlight() { return super.getSecondary3(); }
  50.  
  51.     public ColorUIResource getFocusColor() { return getBlack(); }
  52.  
  53.     public ColorUIResource getTextHighlightColor() { return getBlack(); }
  54.     public ColorUIResource getHighlightedTextColor() { return getWhite(); }
  55.   
  56.     public ColorUIResource getMenuSelectedBackground() { return getBlack(); }
  57.     public ColorUIResource getMenuSelectedForeground() { return getWhite(); }
  58.     public ColorUIResource getAcceleratorForeground() { return getBlack(); }
  59.     public ColorUIResource getAcceleratorSelectedForeground() { return getWhite(); }
  60.  
  61.  
  62.     public void addCustomEntriesToTable(UIDefaults table) {
  63.  
  64.         Border blackLineBorder = new BorderUIResource(new LineBorder( getBlack() ));
  65.         Border whiteLineBorder = new BorderUIResource(new LineBorder( getWhite() ));
  66.  
  67.     Object textBorder = new BorderUIResource( new CompoundBorder(
  68.                                blackLineBorder,
  69.                                    new BasicBorders.MarginBorder()));
  70.  
  71.         table.put( "ToolTip.border", blackLineBorder);
  72.     table.put( "TitledBorder.border", blackLineBorder);
  73.         table.put( "Table.focusCellHighlightBorder", whiteLineBorder);
  74.         table.put( "Table.focusCellForeground", getWhite());
  75.  
  76.         table.put( "TextField.border", textBorder);
  77.         table.put( "PasswordField.border", textBorder);
  78.         table.put( "TextArea.border", textBorder);
  79.         table.put( "TextPane.font", textBorder);
  80.  
  81.  
  82.     }
  83.  
  84. }
  85.